import { isNumber, isStringNumber, isString } from './type'

export const splitUnit = (value: string | number): number => {
  return typeof value === 'number' ? value : parseInt(value.replace('px', ''))
}
export const addUnit = (value: any, defaultUnit = 'px') => {
  if (!value) return ''
  if (isNumber(value) || isStringNumber(value)) {
    return `${value}${defaultUnit}`
  } else if (isString(value)) {
    return value
  }
  console.warn('binding value must be a string or number')
}

